package com.phs.main.web.controller;

import com.phs.main.common.constant.AjaxResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ControllerAdvice {
	/**
	 * 全局捕获异常
	 * @param e 异常
	 * @return 数据
	 */
	@ExceptionHandler({Exception.class, RuntimeException.class})
	public AjaxResult errorHandler(Exception e) {
		return AjaxResult.error(e.getMessage());
	}
}
